home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / comm / tcp / SLIPScripts1_3.lha / SLIPStop.rexx < prev    next >
OS/2 REXX Batch file  |  1995-02-03  |  2KB  |  49 lines

  1. /* SLIPStop.rexx  ver 1.3  Feb. 3, 1995   by Travis Pascoe                */
  2. /*                                        pasc8891@raven.csrv.uidaho.edu  */
  3. /*                                                                        */
  4. /*   SLIPStop is an ARexx script used to disconnect from a slip           */
  5. /*   session and shutdown AmiTCP.                                         */
  6. /*   This script will disconnect the modem in nearly all cases, but       */
  7. /*   it can fail to shutdown AmiTCP if any libraries remain open.         */
  8. /*   To avoid this problem, try to manually shutdown as many TCP          */
  9. /*   applications as possible before running this script.                 */
  10. /*                                                                        */
  11. /*   Requirements:   ARexx   (obviously)                                  */
  12. /*                   rexxserdev.library ver 5.02+   (see Aminet)          */
  13. /*                                      by Joseph M. Stivaletta           */
  14. /*                   AmiTCP ver 3.0b+                                     */
  15. /*                                                                        */
  16. /*   Usage:          From a cli, type:    rx slipstop                     */
  17. /*                                                                        */
  18. /*   Warning:        You MAY need to modify the script in several         */
  19. /*                   places to suit your host dialup settings.            */
  20. /*                   Follow the comments below for assistance.            */
  21.  
  22.     if ~show('L',"rexxsupport.library") then
  23.     if ~addlib('rexxsupport.library', 0, -30, 0) then exit 41
  24.     if ~show('L', "rexxserdev.library") then
  25.     if ~addlib( 'rexxserdev.library', 0, -30, 0) then exit 42
  26.  
  27.     cr        = '0d'x
  28.     attenstr  = '+++'            /* modem attention string     */
  29.     hangupstr = 'ATH0'||cr       /* hayes modem hangup command */
  30.  
  31.     /* I use cslip, change as desired                          */
  32.     address command 'offline rhcslip.device 0'
  33.     delay(100)
  34.  
  35.     dh        = SerOpen('serial.device', 0)
  36.     check     = SerClear(dh)
  37.     /* I use 38400 modem-computer speed, change as desired     */
  38.     check     = SerSetParms(dh, 38400, 8, N, 1)
  39.  
  40.     say 'SLIP shutdown... '
  41.     delay(100)
  42.     SerWrite(dh,  attenstr, length( attenstr))
  43.     delay(100)
  44.     SerWrite(dh, hangupstr, length(hangupstr))
  45.     SerClose(dh)
  46.     address command 'stopnet'
  47.  
  48. exit 0
  49.